package au.com.bus4u.controller.admin;

import au.com.bus4u.controller.BaseController;
import au.com.bus4u.service.ShuttleBusOrderService;
import au.com.bus4u.utils.JsonResult;
import au.com.bus4u.utils.PageData;
import lombok.extern.java.Log;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/admin/shuttleBusOrder")
@Log
public class ShuttleBusOrderController extends BaseController {

    @Autowired
    private ShuttleBusOrderService shuttleBusOrderService;

    /**
     * 保存 新增班车订单
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping({"/add"})
    public JsonResult add() throws Exception {
        PageData pageData = getPageData();
        JsonResult result = new JsonResult();
        shuttleBusOrderService.save(pageData);
        result.setCode(200);
        result.setMsg("操作成功");
        return result;
    }

    @ResponseBody
    @RequestMapping({"/list"})
    public PageData list() throws Exception {
        PageData pd = getPageData();


        PageData result = new PageData();
        result.put("code",0);
        result.put("msg","操作成功");
        result.put("data",shuttleBusOrderService.list(pd));
        return result;
    }
}
